<form id="formEdit">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">操作</h4>
            </div>
            <div class="modal-body">
            	<!-- 以下为要修改的的内容 -->
				<input type="hidden" name="id" data-th-value="${model.id}">
                <div class="form-group">
                	<label for="txt_name">考试名称</label>
                    <input type="text" name="name" data-th-value="${model.name}" class="form-control" id="name" placeholder="考试名称">
                </div>
                <div class="form-group">
                	<label for="txt_xq">学期</label>
                    <input type="text" name="xq" data-th-value="${model.xq}" class="form-control" id="txt_xq" placeholder="学期">
                </div>
                <div class="form-group">
                	<label for="txt_testDate">考试时间</label>
                    <input type="text" name="testDate" data-th-value="${model.testDate}" class="form-control" id="txt_testDate" placeholder="考试时间">
                </div>
				
                <div class="form-group">
                	<label for="txt_type">考试种类</label>
                    <select id="txt_type" class="form-control" name="type"  data-th-value="${model.type}" placeholder="考试种类">
                		<option value="0" data-th-selected="${model.type==0}">平时考核</option>
                		<option value="1" data-th-selected="${model.type==1}">期末考试</option>
                	</select>
                </div>
                <div class="form-group">
                	<label for="txt_status">状态</label>
                    <select id="txt_status" class="form-control" name="status" data-th-value="${model.status}" placeholder="状态">
                		<option value="0" data-th-selected="${model.status==0}">未完成</option>
                		<option value="1" data-th-selected="${model.status==1}">考核中</option>
                		<option value="2" data-th-selected="${model.status==2}">完成</option>
                	</select>
                </div>
                <div class="form-group">
                	<label for="txt_demo">考试说明</label>
                    <textarea class="form-control" name="demo" id="txt_demo" data-th-line="text" rows="3" data-th-text="${model.demo}" placeholder="考试说明"></textarea>
                </div>
                <!-- 以上为要修改的内容 -->
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
            </div>
        </div>
    </div>
</form>
<script type="text/javascript" th:inline="javascript">
    $(function () {
 		var options= {
			message: '验证不通过',
			feedbackIcons: {
              valid: 'glyphicon glyphicon-ok',
              invalid: 'glyphicon glyphicon-remove',
              validating: 'glyphicon glyphicon-refresh'
          	},
          	fields:  {
				name: {
					validators: {
						notEmpty: {
							message: '考试不能为空'
						}
					}
				},
				testDate: {
					validators: {
						notEmpty: {
							message: '考试时间不能为空'
						},
						date:{
							format : 'YYYY-MM-DD',
							message:'请输入有效的日期格式:yyyy-MM-dd'
						}
					}
				},
				xq: {
					validators: {
						notEmpty: {
							message: '生日不能为空'
						}
					}
				}
        	}
		};
        $('#formEdit').bootstrapValidator(options).on('success.form.bv', function(e) {
        	e.preventDefault();							   	//很重要没有它则会提交默认表单，不会做下面的ajax表单提交
            var fd = new FormData($("#formEdit")[0]);
            $.ajax({  
              url: "save",  
              type: "POST",  
              data: fd,  
              processData: false,  // 不处理数据  
              contentType: false,   // 不设置内容类型
              success:function(){
            	  $('#myModal').modal("hide");
              }
            });  
        });

    });
</script>